<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>
  <script>
    //arr长度 <= 3, 取第一位。长度 > 3， arr[i]===arr[i+1], num1加一， arr[i]!==arr[i+1],num1为0
    var findSpecialInteger = function (arr) {
      if (arr.length <= 3) return arr[0]
      let num = Math.ceil(arr.length * 0.25);
      let num1 = 0
      for (let i = 0; i < arr.length - 1; i++) {
        arr[i] === arr[i + 1] ? num1++ : num1 = 0
        if (num === num1) {
          return arr[i]
        }
      }
    };
    console.log(findSpecialInteger(arr = [1, 2, 2, 6, 6, 6, 6, 7, 10]))
  </script>
</body>

</html>